﻿using System;
namespace Producers.Kis.Xtee.Riik.Ee.Producer.Kis {
    
    
    public class DateTimeString : global::Xtee.Core.Schema.XsdString {
        
        public DateTimeString(string value) : 
                base(value) {
            this.Pattern = @"^(([0]?[1-9]|[1|2][0-9]|[3][0|1])[.]([0]?[1-9]|[1][0-2])[.]([0-9]{4}|[0-9]{2}))?$";
            this.Validate();
        }
        
        public DateTimeString() : 
                base(string.Empty) {
        }
        
        public static bool TryParse(string value, out global::Producers.Kis.Xtee.Riik.Ee.Producer.Kis.DateTimeString result) {
            try {
                result = new global::Producers.Kis.Xtee.Riik.Ee.Producer.Kis.DateTimeString(value);
                return true;
            }
            catch (System.Exception ) {
                result = null;
                return false;
            }
        }
        
        public static implicit operator String (DateTimeString value) {
            return value.Value;
        }
        
        public static implicit operator DateTimeString (string value) {
            if (value==null) {
                return null;
            }
            return new DateTimeString(value);
        }
    }
}
